﻿namespace Jet.Dal
{
	/// <summary>
	/// Repository which can create entities or it's proxies
	/// </summary>
	/// <typeparam name="TKey">Type of key</typeparam>
	/// <typeparam name="TEntity">Type of entity</typeparam>
	public interface IEntityFactory<TKey, TEntity> 
		where TKey: class 
		where TEntity:class
	{
		/// <summary>
		/// Creates a new entity(or it's proxy) and assign key properties
		/// </summary>
		TEntity Create(TKey key = null);

		/// <summary>
		/// Creates a key for an entity. 
		/// </summary>
		TKey CreateKey(TEntity source);
	}
}
